package com.zhledu.db;

import java.sql.Connection;
import java.sql.DriverManager;

public class TestWzxf {
    public static void main(String[] args) throws Exception {

        Connection connection = getConnection("", "", "school", "zhli2008");

        System.out.println(connection);
    }

    public static Connection getConnection(String ip, String dbName, String username, String password) throws Exception {
        Connection connection = null;
        Class.forName("com.mysql.cj.jdbc.Driver");
        String url = "jdbc:mysql://127.0.0.1:3306/school?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
        connection = DriverManager.getConnection(url, username, password);
        return connection;

    }
}
